home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / bp7sb103.zip / BP7SB.DOC < prev    next >
Text File  |  1993-09-03  |  11KB  |  397 lines

  1. ▄▄▄▄▄▄▄▄▄
  2. █ BP7SB █
  3. ▀▀▀▀▀▀▀▀▀
  4.  
  5. Thank you for trying BP7SB!
  6.  
  7.  
  8. BP7SB is a Source Beautifier for Turbo / Borland Pascal sources.
  9. (up to Version 7.0) Use it only at your own risk!
  10.  
  11. Please report all bugs and comments to the author:
  12.  
  13.        Jozsef Ferincz
  14.        Bleibtreustr. 32
  15.        D-10707 Berlin
  16.        Germany
  17.  
  18.        Phone:  +49 30 8835822
  19.        E-Mail: ferincz@chemie.fu-berlin.de
  20.                ferincz@fub.uucp
  21.  
  22.  
  23. ════════════════════════════════════════════════════════════════════════════
  24.  
  25.  
  26. Introduction
  27. ────────────
  28.  
  29. BP7SB is a useful tool with many options to format Pascal code in a
  30. consistent form. BP7SB uses default values to reformat the source
  31. code, but with the options you can develop another shape. It makes 
  32. your code OPTICALLY beautiful.
  33.  
  34. BP7SB - if you want - makes keyword conversion (lower, mixed, upper
  35.           case or according to your own pattern or takes the first
  36.           occurrence - only for user words) separately switchable
  37.           for the keyword classes, which are: functions, procedures,
  38.           reserved words, types, variables and constants, TVision
  39.           keywords, user words, the own words will be taken from
  40.           your 'own words collection'.
  41. BP7SB - if you want - structures loops.
  42. BP7SB - if you want - indents record and object structures.
  43. BP7SB - if you want - sets the length of source code line.
  44. BP7SB - if you want - inserts space characters to make your source
  45.           code easier readable.
  46. BP7SB - if you want - replaces TAB characters by 8 space characters.
  47. BP7SB - if you want - identifies loops. (at the keyword 'END')
  48. BP7SB - if you want - makes extra indents after not_closed_brackets.
  49. BP7SB - if you want - reads the options from a file.
  50.  
  51. BP7SB does not check for syntax errors, but you can recognize some of
  52. the syntax errors after structuring by BP7SB. BP7SB also works in the
  53. IDE of Turbo / Borland Pascal. (see in BP7SB-in.IDE)
  54.  
  55. BP7SB recognizes the following built-in keywords:
  56.   739 functions
  57.   197 procedures
  58.    62 reserved words
  59.    94 types
  60.   409 variables and constants
  61.   615 TVision keywords
  62.  
  63.  
  64. ════════════════════════════════════════════════════════════════════════════
  65.  
  66.  
  67. Syntax:
  68. ───────
  69.  
  70. BP7SB [options] source[.PAS]
  71.  
  72. The order of arguments is not significant. The arguments are not
  73. case sensitive. If you use -a or -b:<f|p|r|t|v> options, you will
  74. get your information on a standard output and after that the
  75. program terminates, also if you use other command options.
  76.  
  77. Command options followed by : (colon) must have ONE parameter,
  78. which will follow immediately after the option with no space.
  79.  
  80. The original source file will be saved as a *.BAK backup file.
  81. BP7SB does not use .BAK, .COM, .DLL, .EXE, .OBJ, .RES, .TPP, .TPU
  82. or .TPW files as input. If you don't use an extension after the
  83. input file name, .PAS will be added. Standard wildcards may
  84. be used.
  85.  
  86. Comments in { } or in (* *) and strings in ' ' or " " will not be
  87. altered in the source.
  88.  
  89. Options:
  90. ────────
  91.  
  92. -a       Gives you a short info about BP7SB.
  93.  
  94.  
  95. -b:<f|n|p|r|t|v>     Puts the built-in keywords to a standard output.
  96. The keyword groups are: f-functions, n-TVision, p-procedures,
  97. r-reserved words, t-types, v-variables and constants. If you want to
  98. see more than one keyword group, you may use this option several times.
  99. The following example gives you all built-in keywords:
  100.  
  101.   BP7SB -b:f -b:n -b:p -b:r -b:t -b:v | more
  102.  
  103.  
  104. -c:file  Read options from a file.
  105. You may save the frequently used options in a file. The options
  106. can also be in several lines. The contents of a line is ignored
  107. from the # character. The separators of options are the space, the
  108. end of line and the end of file characters. The options saved in
  109. the file may be updated by a command line. You may save all options
  110. in the file except -a, -b:<f|p|r|t|v> and -c:file options. If the
  111. file isn't in the active directory, you should use the complete
  112. path. If you don't use this option, BP7SB looks for the file
  113. BP7SB.INI in the actual directory in order to read the options.
  114. If BP7SB.INI is not found in the actual directory, BP7SB looks
  115. for BP7SB.INI in the 'HOME' directory of BP7SB.
  116.  
  117. If myoption.cfg is:
  118.  
  119. -d:3 -f:u
  120. #-y:5
  121. -y:6
  122. -r:u
  123.  
  124. You may use:
  125.  
  126.   BP7SB -c:myoption.cfg -y:1 mysource.pas
  127.  
  128.  
  129. -d:n     Switches structuring off or sets the depth of structures.
  130. Accepted values of n are between 0 and 10. Default value of n is 2.
  131. If n is 0, the source code will be not structured, the original
  132. structure will be kept. (In this case [-d:0] you cannot use the
  133. option -l.)
  134.  
  135.   BP7SB -d:3 mysource.pas
  136.  
  137.  
  138. -e       All TAB characters found in the source code will be replaced
  139. by 8 space characters.
  140.  
  141.   BP7SB -e mysource.pas
  142.  
  143.  
  144. -<f|n|p|r|t|v>:<u|l>     Switches the case of built-in keywords.
  145. The groups of built-in keywords are: functions, TVision keywords,
  146. procedures, reserved words, types, variables and constants. You
  147. can choose upper or lower case. Default is mixed case: WriteLn.
  148. In upper case: WRITELN, in lower case: writeln. (You can redefine
  149. it with the option -o:file if you like. e.g.: WRITEln)
  150.  
  151.   BP7SB -r:u -t:l -v:u mysource.pas
  152.  
  153.  
  154. -i:<e|n> Controls how to 'extra indent' after not_closed_brackets
  155. One extra indent for each not_closed_bracket or do not extra indent.
  156. Default is one extra indent for all not_closed_brackets. (i.e. the
  157. next lines get only one extra indent even if the source line has
  158. more than one not_closed_brackets)
  159. If mysource.pas looks like that:
  160. ...
  161. while (not eof(infile)) or
  162.       (((i > counter) or
  163.       (b = 2)) and
  164.       (c <> 'n')) or
  165.       (d >= 10) do
  166. ...
  167.  
  168. After using BP7SB mysource.pas you will get:
  169. ...
  170. While (Not EoF(Infile)) Or
  171.       (((I > Counter) Or
  172.         (B = 2)) And
  173.         (C <> 'n')) Or
  174.       (D >= 10) Do
  175. ...
  176.  
  177. After using BP7SB -i:e you will get:
  178. ...
  179. While (Not EoF(Infile)) Or
  180.       (((I > Counter) Or
  181.           (B = 2)) And
  182.         (C <> 'n')) Or
  183.       (D >= 10) Do
  184. ...
  185.  
  186.  
  187. -k       Keep source compact
  188. If you use this option then BP7SB does not insert space characters,
  189. does not structure record and object definitions, does not make any
  190. extra indent on lines after _not_closed_brackets_.
  191. If mysource.pas looks like that:
  192.  
  193. type
  194. Date=record
  195. D,
  196. M,
  197. Y:Integer;
  198. end;
  199.  
  200. ...
  201.  
  202. if(a<b)or(c=d)then
  203. begin
  204. writeln((a+b)*c,(d^.e-5)/f[(a+b)*g.h]);
  205. a:=d^.e
  206. end;
  207.  
  208. If you use the -k option, BP7SB will not make:
  209.  
  210. {BP7SB mysource.pas}
  211. Type
  212.   Date = Record
  213.            D,
  214.            M,
  215.            Y: Integer;
  216.          End;
  217.  
  218. ...
  219.  
  220.   If (a < b) Or (c = d) Then
  221.   Begin
  222.     WriteLn ( (a + b) * c, (d^. e - 5) / f [ (a + b) * g. h] );
  223.     a := d^. e
  224.   End;
  225.  
  226. but you will get:
  227.  
  228. {BP7SB -k mysource.pas}
  229. Type
  230.   Date=Record
  231.     D,
  232.     M,
  233.     Y:Integer;
  234.   End;
  235.  
  236. ...
  237.  
  238.   If(a<b)Or(c=d)Then
  239.   Begin
  240.     WriteLn((a+b)*c,(d^.e-5)/f[(a+b)*g.h]);
  241.     a:=d^.e
  242.   End;
  243.  
  244.  
  245. -l       Identifies loops
  246. If you use this option you will get _loop_identifiers_ after the
  247. keyword 'END'. The _loop_identifier_ will not be inserted if you
  248. already have some comment - in the same line beginning with
  249. '{' or '(' - after the actual 'END', but if you have at least
  250. 2 space characters after the keyword 'END', the _loop_identifier_
  251. will be inserted. If you change the loop in your source code and
  252. run BP7SB a 2nd time, the _loop_identifier_ will NOT be overwritten.
  253. The _loop_identifiers_ have the same case as the reserved words.
  254. The _loop_identifiers_ are:
  255. { with }
  256. { while }
  257. { if }
  258. { if else }
  259. { for }
  260. { case }
  261. { case else }
  262. { case label }
  263. { record }
  264. { object }
  265. { asm }
  266. { ? }
  267. The 'END's of Program, Unit, Procedure, Function, Constructor,
  268. Destructor and the unrecognized loops will marked with { ? }.
  269.  
  270. If mysource.pas looks like that:
  271. ...
  272.   case n of
  273.     1: begin
  274.          ...
  275.          with a^. do
  276.          begin
  277.            ...
  278.            for i := 1 to k do
  279.            begin
  280.              ...
  281.              if i > n then
  282.              begin
  283.                ...
  284.                writeln(i - n);
  285.              end
  286.              else
  287.              begin
  288.                ...
  289.                writeln(n);
  290.              end;
  291.            end;
  292.          end;
  293.        end;
  294.     2: writeln(n);
  295.     else
  296.     begin
  297.       ...
  298.       writeln(n - 1);
  299.     end;
  300.   end;
  301. ...
  302.  
  303. After using BP7SB -l mysource.pas
  304. ...
  305.   Case N Of
  306.     1: Begin
  307.          ...
  308.          With A^. Do
  309.          Begin
  310.            ...
  311.            For I := 1 To K Do
  312.            Begin
  313.              ...
  314.              If I > N Then
  315.              Begin
  316.                ...
  317.                WriteLn (I - N);
  318.              End { If }
  319.              Else
  320.              Begin
  321.                ...
  322.                WriteLn (N);
  323.              End; { If Else }
  324.            End; { For }
  325.          End; { With }
  326.        End; { Case Label }
  327.     2: WriteLn (N);
  328.     Else
  329.     Begin
  330.       ...
  331.       WriteLn (N - 1);
  332.     End; { Case Else }
  333.   End; { Case }
  334. ...
  335.  
  336.  
  337. -o:file  Use collection of own words
  338. You may give the format of your own words (variables, constants,
  339. types, functions, procedures, ...) in your source code. You may
  340. also redefine the built-in keywords. BP7SB will use this collection
  341. of own words like the built-in keywords. The words in this file
  342. may have characters only from [a..z,_,A..Z,0-9]. All other characters
  343. will be interpreted as separator of words. If you have one word several
  344. times in this file, the last version will be used. The contents of
  345. a line will be ignored from the # character. Your own words may have
  346. a maximal length of 26 characters.
  347.  
  348. If mywords.txt is:
  349.  
  350. MyFunction MyCONSTANT
  351. #WRITEln
  352. writeLN, MYvar
  353.  
  354. You may use:
  355.  
  356.   BP7SB -o:mywords.txt mysource.pas
  357.  
  358.  
  359. -s:m     Length of line in the source code
  360. Default value is 255 characters: function OFF. BP7SB does not
  361. make the source not shorter than 40 characters and does not insert
  362. EoLn character after 255 characters. (The source line can be
  363. longer.)
  364.  
  365.   BP7SB -s:120 mysource.pas
  366.  
  367.  
  368. -u:<f|u|l|n>  Defines the case of user words
  369. User words are the keywords in the source code, which do not match
  370. neither to any built-in nor to any own words. (given by the
  371. option -o:file). f - first occurrence, u - upper, l - lower
  372. case, n - no convert, take it 'as is'. Default is mixed case:
  373. the first character and the character after '_','0'..'9' will be
  374. converted to capitals.
  375.  
  376.   BP7SB -u:f mysource.pas
  377.  
  378.  
  379. -w       No conversion of any keywords
  380.  
  381.   BP7SB -w mysource.pas
  382.  
  383.  
  384. -y:z     Position of lines beginning with { or (* character(s)
  385. If the line in the source code begins with a comment or a compiler
  386. directive, you may define at which column of source this line
  387. begins. The numbering of columns begins with 1. If you don't use
  388. this option, the lines beginning with { or (* character(s) will
  389. be structured like other lines.
  390.  
  391.   BP7SB -y:1 mysource.pas
  392.  
  393.  
  394. ════════════════════════════════════════════════════════════════════════════
  395.  
  396. Turbo / Borland Pascal are trademarks of Borland International, Inc.
  397.